package com.softer.wxzj.controller;

import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.*;
import com.softer.wxzj.service.BaseModifyReqService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wxr
 * @create 2019/5/5 - 17:09 - 星期日
 */

@RestController
@RequestMapping("/baseModifyReq")
@Slf4j
public class BaseModifyReqController {
    @Autowired
    BaseModifyReqService baseModifyReqService;

    /**
     * 获取待审核修改信息列表
     *
     * @param page
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/getAuditUpdateList")
    @LogRecord(description = "获取业委会待审核信息列表", operationUnit = LogOperationUnit.Base_Owner_Committee, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getAuditUpdateList(Page page, BaseModifyReq baseModifyReq) {
        return baseModifyReqService.getAuditUpdateList(page, baseModifyReq);
    }

    /**
     * 查询变更信息列表
     *
     * @param page
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/getList")
    @LogRecord(description = "获取业委会变更信息列表", operationUnit = LogOperationUnit.Base_Owner_Committee, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getList(Page page, BaseModifyReq baseModifyReq) {
        return baseModifyReqService.getList(page, baseModifyReq);
    }

    /**
     * 查询业主信息变更列表
     *
     * @param page
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/getChangeOwnerList")
    @LogRecord(description = "查询业主信息变更列表", operationUnit = LogOperationUnit.BASE_MODIFY_REQ, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getChangeOwnerList(Page page, BaseModifyReq baseModifyReq) {
        log.info("查询业主信息变更列表");
        return baseModifyReqService.getChangeOwnerList(page, baseModifyReq);
    }

    /**
     * 查询房屋变更审核列表
     *
     * @param page
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/selectUpdate")
    @LogRecord(description = "查询房屋变更审核列表", operationUnit = LogOperationUnit.BASE_MODIFY_REQ, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> selectUpdate(Page page, BaseModifyReq baseModifyReq) {
        return baseModifyReqService.selectUpdate(page, baseModifyReq);

    }

    /**
     * 查询房屋变更查询列表
     *
     * @param page
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/selectUpdateHouseList")
    @LogRecord(description = "查询房屋变更查询列表", operationUnit = LogOperationUnit.BASE_MODIFY_REQ, operationType = LogOperationType.SELECT)
    PageInfo<BaseModifyReq> selectUpdateHouseList(Page page, BaseModifyReq baseModifyReq) {
        return baseModifyReqService.selectUpdateHouseList(page, baseModifyReq);
    }

    /**
     * 自然幢变更审核列表
     *
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/getUpdateList")
    @LogRecord(description = "自然幢变更审核列表", operationUnit = LogOperationUnit.BASE_BUILE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getUpdateList(Page page, BaseModifyReq baseModifyReq, String flowType) {
        return baseModifyReqService.getUpdateList(page, baseModifyReq, flowType);
    }

    /**
     * 自然幢变更列表
     *
     * @param baseModifyReq
     * @return
     */
    @RequestMapping("/selectChange")
    @LogRecord(description = "自然幢变更列表", operationUnit = LogOperationUnit.BASE_BUILE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getUpdate(Page page, BaseModifyReq baseModifyReq) {
        return baseModifyReqService.getUpdate(page, baseModifyReq);
    }

    /**
     * 模糊查询业主信息变更列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 业主信息变更列表
     */
    @RequestMapping("/ownerModifyFuzzySearch")
    @LogRecord(description = "模糊查询业主信息变更列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseOwnerFuzzy> ownerModifyFuzzySearch(Page page, String param) {
        return baseModifyReqService.ownerModifyFuzzySearch(page, param);
    }

    /**
     * 模糊查询小区变更审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 小区变更审核列表
     */
    @RequestMapping("/regionModifyFuzzySearch")
    @LogRecord(description = "模糊查询小区变更审核列表", operationUnit = LogOperationUnit.BASE_REGION_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseRegionInfo> regionModifyFuzzySearch(Page page, String param) {
        return baseModifyReqService.regionModifyFuzzySearch(page, param);
    }

    /**
     * 模糊查询自然幢变更审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 自然幢变更审核列表
     */
    @RequestMapping("/buildModifyFuzzySearch")
    @LogRecord(description = "模糊查询自然幢变更审核列表", operationUnit = LogOperationUnit.BASE_BUILD_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseBuildInfo> buildModifyFuzzySearch(Page page, String param) {
        return baseModifyReqService.buildModifyFuzzySearch(page, param);
    }

    /**
     * 模糊查询业主变更审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 业主变更审核列表
     */
    @RequestMapping("/ownerModifyAuditFuzzySearch")
    @LogRecord(description = "模糊查询业主变更审核列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseOwnerFuzzy> ownerModifyAuditFuzzySearch(Page page, String param) {
        return baseModifyReqService.ownerModifyAuditFuzzySearch(page, param);
    }

    /**
     * 模糊查询房屋调换审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋调换审核列表
     */
    @RequestMapping("/houseModifyAuditFuzzySearch")
    @LogRecord(description = "模糊查询房屋调换审核列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseBuildModifyDetail> houseModifyAuditFuzzySearch(Page page, String param) {
        return baseModifyReqService.houseModifyAuditFuzzySearch(page, param);
    }

    /**
     * 模糊查询房屋合并/拆分审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋合并/拆分审核列表
     */
    @RequestMapping("/splitMergeAuditFuzzySearch")
    @LogRecord(description = "模糊查询房屋合并/拆分审核列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<SplitMergeReqList> splitMergeAuditFuzzySearch(Page page, String param) {
        return baseModifyReqService.splitMergeAuditFuzzySearch(page, param);
    }

    /**
     * 模糊查询房屋变更审核列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋变更审核列表
     */
    @RequestMapping("/houseChangeAuditFuzzySearch")
    @LogRecord(description = "模糊查询房屋变更审核列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> houseChangeAuditFuzzySearch(Page page, String param) {
        return baseModifyReqService.houseChangeAuditFuzzySearch(page, param);
    }

    /**
     * 模糊查询小区变更查询列表
     *
     * @param page       分页实体
     * @param param      模糊查询参数
     * @param businessId 小区ID
     * @return 小区变更查询列表
     */
    @RequestMapping("/regionAuditSearchFuzzy")
    @LogRecord(description = "模糊查询小区变更查询列表", operationUnit = LogOperationUnit.BASE_REGION_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> regionAuditSearchFuzzy(Page page, String param, String businessId) {
        return baseModifyReqService.regionAuditSearchFuzzy(page, param, businessId);
    }

    /**
     * 模糊查询自然幢变更查询列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 自然幢变更查询列表
     */
    @RequestMapping("/buildAuditSearchFuzzy")
    @LogRecord(description = "模糊查询自然幢变更查询列表", operationUnit = LogOperationUnit.BASE_BUILE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> buildAuditSearchFuzzy(Page page, String param) {
        return baseModifyReqService.buildAuditSearchFuzzy(page, param);
    }

    /**
     * 模糊查询房屋调换变更查询列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋调换变更查询列表
     */
    @RequestMapping("/houseModifyAuditSearchFuzzy")
    @LogRecord(description = "模糊查询房屋调换变更查询列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseBuildModifyDetail> houseModifyAuditSearchFuzzy(Page page, String param) {
        return baseModifyReqService.houseModifyAuditSearchFuzzy(page, param);
    }

    /**
     * 模糊查询房屋变更查询列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋变更查询列表
     */
    @RequestMapping("/houseChangeAuditSearchFuzzy")
    @LogRecord(description = "模糊查询房屋变更查询列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> houseChangeAuditSearchFuzzy(Page page, String param) {
        return baseModifyReqService.houseChangeAuditSearchFuzzy(page, param);
    }

    /**
     * 模糊查询房屋变更查询列表
     *
     * @param page          分页实体
     * @param baseHouseInfo 模糊查询参数
     * @return 房屋变更查询列表
     */
    @RequestMapping("/houseChangeAuditSearchFuzzyByHouse")
    @LogRecord(description = "模糊查询房屋变更查询列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> houseChangeAuditSearchFuzzyByHouse(Page page, BaseHouseInfo baseHouseInfo) {
        return baseModifyReqService.houseChangeAuditSearchFuzzyByHouse(page, baseHouseInfo);
    }

    /**
     * 模糊查询房屋业主变更查询列表
     *
     * @param page  分页实体
     * @param param 模糊查询参数
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/ownerAuditSearchFuzzy")
    @LogRecord(description = "模糊查询房屋业主变更查询列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> ownerAuditSearchFuzzy(Page page, String param) {
        return baseModifyReqService.ownerAuditSearchFuzzy(page, param);
    }

    /**
     * 房屋业主变更查询列表
     *
     * @param page 分页实体
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/selectChangeOwner")
    @LogRecord(description = "房屋业主变更查询列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> selectChangeOwner(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.selectChangeOwner(baseModifyReq, page);
    }

    /**
     * 房屋业主变更审核查询列表
     *
     * @param page 分页实体
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/getOwnerUpdateList")
    @LogRecord(description = "房屋业主变更审核查询列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getOwnerUpdateList(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.getOwnerUpdateList(baseModifyReq, page);
    }

    /**
     * 提交审核
     *
     * @param id 变更id
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/addModify")
    @LogRecord(description = "提交审核", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public CommonResult addModify(String id, String buildNo, String modifyCause) {
        return baseModifyReqService.addModify(id, buildNo, modifyCause);
    }

    /**
     * 结构变更审核
     *
     * @param id
     * @return
     */
    @RequestMapping("/changeResidentialCommittee")
    @LogRecord(description = "结构变更审核", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public CommonResult changeResidentialCommittee(String buildNo, String id, String opinion, String mark) {
        return baseModifyReqService.changeResidentialCommittee(buildNo, id, opinion, mark);
    }

    /**
     * 单元变更审核查询列表
     *
     * @param page 分页实体
     * @return 单元变更查询列表
     */
    @RequestMapping("/getCellUpdateList")
    @LogRecord(description = "结构变更审核查询列表", operationUnit = LogOperationUnit.BASE_CELL_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getCellUpdateList(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.getCellUpdateList(baseModifyReq, page);
    }

    /**
     * 房屋结构变更审核查询列表
     *
     * @param page 分页实体
     * @return 单元变更查询列表
     */
    @RequestMapping("/getHouseUpdateList")
    @LogRecord(description = "结构变更审核查询列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> getHouseUpdateList(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.getHouseUpdateList(baseModifyReq, page);
    }

    /**
     * 结构变更查询列表
     *
     * @param page 分页实体
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/selectChangeHouse")
    @LogRecord(description = "房屋结构变更查询列表", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> selectChangeHouse(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.selectChangeHouse(baseModifyReq, page);
    }

    /**
     * 结构变更查询列表
     *
     * @param page 分页实体
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/selectChangeCell")
    @LogRecord(description = "房屋业主变更查询列表", operationUnit = LogOperationUnit.BASE_OWNER_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<BaseModifyReq> selectChangeCell(BaseModifyReq baseModifyReq, Page page) {
        return baseModifyReqService.selectChangeCell(baseModifyReq, page);
    }

    /**
     * 房屋结构变更提交审核
     *
     * @param id 变更id
     * @return 房屋业主变更查询列表
     */
    @RequestMapping("/addModifyCell")
    @LogRecord(description = "提交审核", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public CommonResult addModifyCell(String id, String buildNo, String modifyCause) {
        return baseModifyReqService.addModifyCell(id, buildNo, modifyCause);
    }

    /**
     * 单元结构变更重置
     *
     * @param id 变更id
     */
    @RequestMapping("/resetting")
    @LogRecord(description = "单元结构变更重置", operationUnit = LogOperationUnit.BASE_HOUSE_INFO, operationType = LogOperationType.SELECT)
    public CommonResult resetting(String id, String type) {
        return baseModifyReqService.resetting(id, type);
    }
}
